#!/usr/bin/env python
# encoding: utf-8

from flask_cors import CORS
from flask import Flask, redirect  # 导入flask
from logging.config import dictConfig
from flask_caching import Cache
#from app.config import config  # 导入配置文件中的Config

cache = Cache(config={'CACHE_TYPE': 'simple'})

def create_app():
    app = Flask("FLASK_STUDY")
    #app.config.from_object(config[os.getenv('FLASK_ENV') or 'default'])

    CORS(app)

    cache.init_app(app)

    from app.api import bp as api_blueprint  # API蓝图
    app.register_blueprint(api_blueprint, url_prefix='/api/v1')

    # zipkin.init_app(app)

    @app.route('/')
    def index():
        return redirect('/api/v1')

    return app

